package com.ruoyi.project.system.domain;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;

/**
 * 收益对象 sys_earnings
 *
 * @author ruoyi
 * @date 2024-07-23
 */
@Accessors(chain = true)
@Data
public class SysEarnings extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 收益记录id
     */
    private Long earningsId;

    /**
     * 用户id
     */
    @Excel(name = "用户id")
    private Long userId;

    /**
     * 收益来源类型
     */
    @Excel(name = "收益来源类型")
    private String type;

    /**
     * 退款处理
     */
    @Excel(name = "退款处理")
    private String refundDis;

    /**
     * 来源单号
     */
    @Excel(name = "来源单号")
    private String sourceId;

    /**
     * 来源金额
     */
    @Excel(name = "来源金额")
    private BigDecimal amount;

    /**
     * 收益提现记录的id
     */
    @Excel(name = "收益提现记录的id")
    private String extractId;

    public SysEarnings() {
    }

    public SysEarnings(String earningsId) {
        this.earningsId = Long.parseLong(earningsId);
    }

    public SysEarnings(Long earningsId, String extractId) {
        this.earningsId = earningsId;
        this.extractId = extractId;
    }

    public SysEarnings(Long userId, String type, String sourceId, String remark) {
        this.userId = userId;
        this.type = type;
        this.sourceId = sourceId;
        this.setRemark(remark);
    }

    public SysEarnings(Long userId, String type, String sourceId, BigDecimal amount) {
        this.userId = userId;
        this.type = type;
        this.sourceId = sourceId;
        this.amount = amount;
        this.setCreateTime(DateUtils.getNowDate());
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("earningsId", getEarningsId())
                .append("userId", getUserId())
                .append("type", getType())
                .append("sourceId", getSourceId())
                .append("amount", getAmount())
                .append("extractId", getExtractId())
                .append("remark", getRemark())
                .append("createTime", getCreateTime())
                .toString();
    }
}
